package com.tywj.buscustomerapp.view.item;

import android.content.Intent;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.tywj.buscustomerapp.R;
import com.tywj.buscustomerapp.model.bean.TourismApp;
import com.tywj.buscustomerapp.utils.myadapter.item.AdapterItem;
import com.tywj.buscustomerapp.view.activity.tour.ScenicTicketActivity;

public class TourismItem implements AdapterItem<TourismApp> {
    private ImageView imageView;
    private TextView textView;
    private LinearLayout click;

    @Override
    public int getLayoutResId() {
        return R.layout.tourism_app_layout;
    }

    @Override
    public void bindViews(@NonNull View root) {
        imageView = root.findViewById(R.id.touritem_img);
        textView = root.findViewById(R.id.touritem_text);
        click = root.findViewById(R.id.click);
    }

    @Override
    public void setViews() {

    }

    @Override
    public void handleData(TourismApp tourismApp, int position) {
        imageView.setImageResource(tourismApp.ImageId);
        textView.setText(tourismApp.title);
        click.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.getContext().startActivity(new Intent(v.getContext(), ScenicTicketActivity.class));
            }
        });
    }

}
